
package com.xy.entity.msg;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.xy.common.jpa.AbstractTimestampEntity;
import com.xy.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.*;

@Entity
@Data
public class SystemMsg extends AbstractTimestampEntity {


    @ApiModelProperty(value="是否阅读",name="status")
    private int status;//是否阅读
    private String msgId;//外键关联user_msg
    @ApiModelProperty(value="推送时间",name="pushTime")
    private Date pushTime;//推送时间
    @ApiModelProperty(value="标题",name="title")
    private String title;//标题
    @ApiModelProperty(value="内容",name="msg")
    private String msg;//内容

    @Transient
    private int sum;//计算status的数量
    @Transient
    private List<SystemMsg> systemMsg = new ArrayList<>();

    @JSONField(serialize = false)
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.EAGER)
    @JoinColumn(name = "userId")
    private User user;

}

